﻿@using KRM.Core
@{
    ViewBag.Title = "Ticket System";
    Layout = "~/Views/Shared/_Layout.cshtml";
    IEnumerable<vWebTicketAudit> activities = ViewBag.Activities;
}
<script src="~/js/plugins/tagsinput/jquery.tagsinput.min.js"></script>
<link href="~/js/plugins/tagsinput/jquery.tagsinput.css" rel="stylesheet" />
<link href="/js/plugins/uploadfile/uploadfile.css" rel="stylesheet">
<script src="/js/plugins/uploadfile/jquery.uploadfile.min.js"></script>
<script src="~/js/ticket.js"></script>
<script src="~/js/plugins/tinymce/tinymce.min.js"></script>
<div id="ModalAddTaskFromTicket" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
<div id="ModalViewTicketHistory" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
<div id="ModalLinkMailToOtherTicket" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-width="800"></div>
<div id="ModalQuickReply" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-width="800"></div>
<div style="display: none">@Html.Partial("Partial/_MessageResult")</div>


<div style="padding-top: 10px">
    <ul class="tabs tabs-inline tabs-top ticket-tabs" id="tabViewTicket">
        <li class="ticket-tab-new">
            <a href="#newticket" data-toggle="tab" onclick="LoadJqueryNewTicket()"><i class="icon-plus-sign-alt"></i>Add</a>
        </li>
        <li class="active">
            <a href="#dashboard" data-toggle="tab"><i class="icon-home"></i>DashBoard</a>
        </li>
    </ul>
    <div class="tab-content padding tab-content-inline tab-content-bottom orderdetail-task-tabs-content" id="tabpanel-viewticket">
        <div class="tab-pane active" id="dashboard">
            <div class="row-fluid">
                <ul class="tabs tabs-inline tabs-top ticket-tabs-dashboard">
                    <li class='settingtab' style="float: right">
                        <a href="#Settings" style="border: 1px solid #ddd;" data-toggle="tab" title="Setting">
                            <i class="icon-cog"></i>
                        </a>
                    </li>
                    <li class='settingtab' style="float: right; margin-right: 10px">
                        <a class="btn btn-mini btn-refresh-board" style="border: 1px solid #ddd;" title="Refresh DashBoard">
                            <i class="icon-refresh" style="width: 12px !important;"></i>
                        </a>
                    </li>
                    <li class="active">
                        <a href="#currentticket" data-toggle="tab">
                            <div class="ticket-active-circle"></div>
                            CURRENT</a>
                    </li>
                    @if (ViewBag.Enable)
                    {
                        <li>
                            <a href="#allticket" data-toggle="tab">
                                <div class="ticket-active-circle"></div>
                                DEPARTMENTS</a>
                        </li>
                    }
                    <li class='settingtab assign-div' style="float: left; margin-left: 35px; display: none">
                        @if (ViewBag.Enable)
                        {
                            <div class="row-fluid">
                                <div class="span3" style="line-height: 28px">Assign To</div>
                                <div class="span7">
                                    @Html.DropDownList("AssignToUserId", null, new { @class = "input-block-level", style = "min-height:28px; height: 28px" })
                                </div>
                                <div class="span2">
                                    <input type="button" id="btn-assignto" class="btn btn-primary" style="height: 28px" value="Assign" />
                                </div>
                            </div>
                        }
                    </li>
                    <li class='settingtab search-tab' style="float: right; width: 315px; display: none;">
                        <form action="/ticket" method="get" class="margin0" id="fr-searchticketid">
                            <input type="hidden" name="statusid" id="hf-statusid" />
                            <input type="hidden" name="departmentid" id="hf-departmentid" />
                            <div class="row-fluid">
                                <div class="span7">
                                    <input type="text" name="search" placeholder="Enter keyword" class="input-block-level" style="height: 28px; min-height: 28px;" />
                                </div>
                                <div class="span5">
                                    <input type="submit" class="btn btn-primary" style="height: 28px" value="Search" />
                                    <input type="button" class="btn btn-danger btn-deletetickets" style="height: 28px; display: none" value="Delete" />
                                </div>
                            </div>
                        </form>
                    </li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active tab-pane-dashboard" id="currentticket">
                        <div class="row-fluid">
                            <div class="span3">
                                <div class="ticket-activities-scroll scrollable " data-visible="true">
                                    <div class="border-padding10 margin0 " style="background: #F7F7F7">
                                        <h5 class="margin0">Activities
                                            <a class="btn btn-mini btn-refresh-activities" style="float: right; padding: 1px 6px 1px 6px; border-radius: 2px;"></a>
                                        </h5>
                                        <div class="ticket-activities">
                                            @foreach (var item in activities)
                                            {
                                                <div class="ticket-activity-item" onclick="viewticket('@item.TicketID', '@item.Subject')">
                                                    <div class="row-fluid">
                                                        <div class="span2">
                                                            <img alt="" src="/Upload/Avatar/@item.Avatar" onError="this.src='/upload/avatar/avatar-default.jpg';" style="background-color: #ddd !important; border-radius:3px; margin-top: 4px ">
                                                        </div>
                                                        <div class="span10">
                                                            <div class="ticket-activity-item-status">
                                                                @item.Username <strong>@item.Action</strong> on "@item.Subject".
                                                            </div>
                                                            <div class="ticket-activity-item-date">
                                                                @string.Format("{0:hh:mm, dd/MM/yyyy}", item.Date)
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            }
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="span9" id="listcurrentticket">
                                @Html.Action("CurrentTicket")
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane tab-pane-dashboard" id="allticket">
                        @Html.Action("AllTicket")
                    </div>
                    <div class="tab-pane tab-pane-dashboard" id="Settings">
                        @Html.Action("Settings")
                    </div>
                </div>
            </div>
        </div>
        <div id="newticket" class="tab-pane">
            @Html.Action("NewTicket")
        </div>
    </div>
</div>
